home *** CD-ROM | disk | FTP | other *** search
- Comparing Identifiers and Variables
- -----------------------------------
- == string 1 equal to string 2
- != string 1 not equal to string 2
- < string 1 less than string 2
- > string 1 larger than string 2
- <= string 1 less than or equal to string 2
- >= string 1 greater than or equal to string 2
- // string 1 multiple of string 2
- \\ string 1 not a multiple of string 2
- isin string 1 is in string 2
- iswm wildcard 1 matches string 2
- ison nick 1 is on channel 2
- isop nick 1 is op'd on channel 2
- isnum number 1 is in range 2
- ischan you are on channel 1
- isauto nick 1 is autoop for channel 2
- isignore nick 1 is in ignore list with ignore swith 2
- isprotect nick 1 is in protect list for channel 2
- isnotify nick 1 is in notify list
- && and
- || or
-
- Example Comparisons
- -------------------
- optest {
- if ($$1 isop $$2) {
- echo 4 $$1 does have ops in $$2
- halt
- }
- echo 4 $$1 does not have ops in $$2
- }
-
- Then when you /optest {nick} {channel} the statment would check to see if {nick} had ops in
- {channel} and if they did it would echo 4 {nick} does have ops in {channel} and then halt(stops the
- statement right there). If {nick} did not have ops in {channel} it would echo 4 that they did not.
-
- jointest {
- if ($me ison $$1) {
- echo 2 You're already on that channel!
- halt
- }
- join $$1
- }
-
- Now you can /jointest {chan} and the statement will check to see if you($me) are already on(ison)
- that channel($$1) and if you are it will echo that you're already on that channel then stop(halt). If
- your not on that channel it will join it($$1).
-
- awaytest {
- if ($away == $true) {
- echo 5 You are currently marked as being away.
- }
- if ($away == $false) {
- echo 5 You are currently not marked as being away.
- }
- }
- awaytest2 {
- if ($away == $true) {
- echo 4 Yup, you're away.
- }
- if ($away != $true) {
- echo 4 Nope, you're still here.
- }
- }
- awaytest3 {
- if ($away == $true) {
- echo 6 Where'd you go?
- halt
- }
- echo 6 You're here.
- }
- Note: The $away identifier returns $true if you're marked away and $false
- if you are here.
-
- There are many different ways to write a single if-then-else statement as shown with the awaytest
- statements . They all will do the same thing, but are quite different from each other.
-
- timecheck {
- if ($left(2,$time) >= 20) {
- echo 2 It's past your bedtime. mIRC Shutting down. Go to bed.
- quit Goodnight Everyone
- .timer 1 10 /exit
- halt
- }
- echo 2 Its still early, you can chat a while longer.
- }
-
- This takes the left 2 characters,the hours, from the current time and if its equal to or greater
- than(>=) 20(10pm) it tells you to go to bed, quits irc, starts a timer to close mIRC, and stops
- there(halt). If its not 10pm yet it says you can stay up a little longer.